package com.tensquare.spit.dao;
/*
 *ClassName:SpitDao
 *Description:吐槽数据访问层
 *@author:可爱的大鸭子
 */

import com.tensquare.spit.pojo.Spit;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

public interface SpitDao extends MongoRepository<Spit, String> {
    /**
     * 根据上级ID查询吐槽（评论）列表（分页）
     * @param parentid
     * @param pageable
     * @return
     */
    public Page<Spit> findByParentid(String parentid, Pageable pageable);

    public List<Spit> findByParentid(String parentid);

    public Page<Spit> findAllByParentidAndStateOrderByPublishtimeDesc(String parentid,String state,Pageable pageable);

    public List<Spit> findTop4OrOrderByVisits();
}
